package jdbc;

import java.sql.*;
import java.text.MessageFormat;

/**
 * @author oldliu
 * @since 1.0
 */
public class JdbcDemo2 {
    public static void main(String[] args) {
        try {
            Class.forName("com.mysql.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
        String url = "jdbc:mysql://localhost:3306/java76?useSSL=false";
        Connection connection = null;
        Statement st = null;
        try {
            connection = DriverManager.getConnection(url, "root", "root1234");
            System.out.println(connection.getClass().getName());

            st = connection.createStatement();
            int num = st.executeUpdate("delete from s_subject where id=53");
            System.out.printf("%d行被删除了",num);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            try {
                st.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
            try {
                connection.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
